package com.xhtt.smart.card.common.msg.bytes;


/**
 * Netty server 返回的信息
 *
 * @author wangze
 * @date 2018-07-03 15:15.
 **/
public class ServerByteMessage {
    /**
     * 固定帧头0xAA
     */
    private byte frameHeader = (byte) 0xAA;

    /**
     * 传输码
     */
    private byte transferCode;


    /**
     * 功能数 默认就是1
     */
    private byte functionNumber = 1;


    /**
     * 功能码
     */
    private byte functionCode;


    /**
     * 数据长度
     */
    private byte dataLength;


    /**
     * 数据域
     */
    private byte[] data;


    /**
     * 校验码
     */
    private byte checkNumber;

    /**
     * 帧尾
     */
    private byte frameFoot = (byte) 0xBB;


    public ServerByteMessage(byte transferCode, byte functionCode, byte[] data) {
        this.transferCode = transferCode;
        this.functionCode = functionCode;
        this.data = data;
        this.dataLength = (byte) data.length;
        //TODO 添加校验码
    }


    public byte getFrameHeader() {
        return frameHeader;
    }

    public byte getTransferCode() {
        return transferCode;
    }

    public void setTransferCode(byte transferCode) {
        this.transferCode = transferCode;
    }

    public byte getFunctionNumber() {
        return functionNumber;
    }


    public byte getFunctionCode() {
        return functionCode;
    }

    public void setFunctionCode(byte functionCode) {
        this.functionCode = functionCode;
    }

    public byte getDataLength() {
        return dataLength;
    }

    public void setDataLength(byte dataLength) {
        this.dataLength = dataLength;
    }

    public byte[] getData() {
        return data;
    }

    public void setData(byte[] data) {
        this.data = data;
    }

    public byte getCheckNumber() {
        return checkNumber;
    }

    public void setCheckNumber(byte checkNumber) {
        this.checkNumber = checkNumber;
    }

    public byte getFrameFoot() {
        return frameFoot;
    }

    public void setFrameFoot(byte frameFoot) {
        this.frameFoot = frameFoot;
    }

}
